//
//  YKTagButton.m
//  baisi
//
//  Created by 吴高烽 on 2016/11/4.
//  Copyright © 2016年 吴高烽. All rights reserved.
//

#import "YKTagButton.h"

@implementation YKTagButton
-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setImage:[UIImage imageNamed:@"chose_tag_close_icon"] forState:UIControlStateNormal];
        self.backgroundColor = YKTagBackgroundColor ;
        self.titleLabel.font = YKTagFont ;
        
    }
    return self ;
}
-(void)setTitle:(NSString *)title forState:(UIControlState)state{
    [super setTitle:title forState:state];
    [self sizeToFit];
    self.width += 3 * YKTagButtonMargin ;
    self.height = YKTagButtonH ;
    
}
-(void)layoutSubviews{
    [super layoutSubviews];
    
    self.titleLabel.x = YKTagButtonMargin ;
    self.imageView.x = CGRectGetMaxX(self.titleLabel.frame) + YKTagButtonMargin ;
}
@end
